import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询轮播列表
export function listBanner(data) {
  return request({
    url: '/market/banner/bannerList',
    method: 'post',
    data: data
  })
}

// 查询轮播详细
export function getBanner(bannerId) {
  return request({
    url: '/market/banner/' + parseStrEmpty(bannerId),
    method: 'get'
  })
}

// 新增轮播
export function addBanner(data) {
  return request({
    url: '/market/banner',
    method: 'post',
    data: data
  })
}

// 修改轮播
export function updateBanner(data) {
  return request({
    url: '/market/banner',
    method: 'put',
    data: data
  })
}

// 删除轮播
export function delBanner(bannerId) {
  return request({
    url: '/market/banner/' + bannerId,
    method: 'delete'
  })
}

// 轮播状态修改
export function changeBannerStatus(bannerId, status) {
  const data = {
    bannerId,
    status
  }
  return request({
    url: '/market/banner/bannerChangeStatus',
    method: 'put',
    data: data
  })
}
